/**
 * @author LKQ
 * @date 2022/1/10 22:25
 * @description
 */
public class Solution {
    public static void main(String[] args) {
        Solution solution = new Solution();
        int[] nums = {3, 4, 5, 1, 2};
        solution.findMin(nums);
    }

    public int findMin(int[] nums) {
        int n = nums.length, left = 0, right = n-1;
        while (left < right) {
            int mid = (right - left) / 2 + left;
            if (nums[mid] < nums[right]) {
                right = mid;
            }else {
                left = mid + 1;
            }
        }
        return nums[left];
    }
}
